
import datetime
import time

def subTime(st, et):
    startTime = datetime.datetime.strptime(st, "%H:%M:%S")
    endTime = datetime.datetime.strptime(et, "%H:%M:%S")

    timeSlot = []

    # while startTime.time() < endTime.time():
    while startTime < endTime:
        startTime = startTime+datetime.timedelta(minutes=30)

        timeSlot.append(startTime.strftime("%H:%M:%S"))

    return timeSlot


if __name__ == "__main__":

    ticks = time.time()
    print ("当前时间戳为:", ticks)

    print (datetime.datetime.now())

    localtime = time.localtime(time.time())
    print ("本地时间为 :", localtime)


    print (time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()))

    print ((datetime.datetime.now()+datetime.timedelta(minutes=30)).strftime('%H:%M:%S'))

    print("timeSlot：", subTime("09:00:00", "18:00:00"))